<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateQuestionnaireFormsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('questionnaire_forms', function (Blueprint $table) {
            $table->id()->from(config('migration.from'));

            $table->string('legal_form_type')->unsigned()->comment('Правовая форма');
            $table->foreign('legal_form_type')->references('key')->on('types')
                ->onDelete('restrict')->onUpdate('restrict');

            $table->text('question')->nullable();
            $table->text('description')->nullable();

            $table->boolean('required')->default(false)->comment('Обязательный');
            $table->integer('order')->default(0)->comment('Сортировка');
            $table->boolean('some')->default(false)->comment('Несколько');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('questionnaire_forms');
    }
}
